package com.cf.controller;

import com.cf.entity.AccountType;
import com.cf.entity.AccountTypeIdType;
import com.cf.entity.Result;
import com.cf.service.AccountTypeIdTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@CrossOrigin
@RestController
public class AccountTypeIdTypeController {

    @Autowired
    private AccountTypeIdTypeService accountTypeIdTypeService;

    @RequestMapping("/selectAllAccountTypeAndidType")
    public Object selectAllAccountTypeAndidType(){
        List<AccountTypeIdType> accountTypeIdTypes = accountTypeIdTypeService.selectAllAccountTypeAndidType();
        if (accountTypeIdTypes.size()!=0){
            return new Result(200,"查询成功",accountTypeIdTypes);
        }
        return new Result(400,"查询失败",null);
    }

    @RequestMapping("/updateAccountTypeAndidType")
    public Object updateAccountTypeAndidType(AccountTypeIdType accountTypeIdType){
        int i = accountTypeIdTypeService.updateAccountTypeAndidType(accountTypeIdType);
        if (i==1){
            return new Result(200,"修改成功",null);
        }
        return new Result(400,"修改失败",null);
    }
}
